<?php
	require_once("phpmailer/class.phpmailer.php");
	class MyMailer extends PhpMailer{
		function __construct($exceptions = false){
			parent::__construct($exceptions);
			
			$this->SMTPDebug = MAIL_SMTP_DEBUG;
			$this->CharSet = MAIL_ENCODING;
			if(MAIL_SMTP==true){
				$this->IsSMTP();
				$this->SMTPAuth   = MAIL_SMTP_AUTH;                  // enable SMTP authentication
				if(MAIL_SMTP_SSL==true) $this->SMTPSecure = "ssl";  
				$this->Host       = MAIL_SMTP_HOST; // sets the SMTP server
				$this->Port       = MAIL_SMTP_PORT;                    // set the SMTP port for the GMAIL server  
				if(MAIL_SMTP_AUTH==true){
					$this->Username   = MAIL_SMTP_USERNAME; // SMTP account username
					$this->Password   = MAIL_SMTP_PASSWORD;        // SMTP account password
				}
			}else{
				$this->IsMail();
			}
			$mail_from = MAIL_FROM;
			if(!empty($mail_from)){
				$mail_from_name = MAIL_FROM_NAME;
				if(!empty($mail_from_name)){
					$this->SetFrom(MAIL_FROM, MAIL_FROM_NAME);
				}else{
					$this->SetFrom(MAIL_FROM);
				}
			}else{
				$this->SetFrom(MAIL_SMTP_USERNAME);
			}
		}
	}